
class ImagehostinggrPlugin:
	def __init__(self):
		# put all the links this plugins supports here - it will be used to filter supported URLs
		self.supported_sites = ['www.imagehosting.gr']
		# the URLs we support
		self.supported_urls = ['www.imagehosting.gr/view.php']

	def get(self, url):
		"""Get the file from the url"""
		for line in urllib2.urlopen(url).read().splitlines():
			if line.find('imagenames') != -1:
				url = line.split('Array(')[1].split(')')[0].strip(" '")
				break
		local_file = get_filename_from_url(url)
		download_file_with_retries(local_file, url)
		config.report.report_finish(local_file)

	def url_matches(self, url):
		"""Check whether we support this URL"""
		# see if the url contains a substring we are looking for
		for l in self.supported_urls:
			if url.find(l) != -1:
				return True
		return False

	def version(self):
		"""Return plugin version - when interface changes, the version changes"""
		return 1

modules = [ImagehostinggrPlugin()]
